<?php

class ZendBlog_Filter_HTMLPurifier implements Zend_Filter_Interface
{
   
    protected $_htmlPurifier = null;

    public function __construct($key, $value)
    {
        require_once 'HtmlPurifier/HTMLPurifier.auto.php';

        $config = HTMLPurifier_Config::createDefault();
        $config->set($key, $value);
//        $config->set(
//            'HTML.Allowed',
//            'p,em,h1,h2,h3,h4,h5,strong,a[href],ul,ol,li,code,pre,'
//            .'blockquote,img[src|alt|height|width],sub,sup'
//        );
        $config->set(
            'AutoFormat.Linkify',
            'true'
        );
        $config->set(
            'AutoFormat.AutoParagraph',
            'true'
        );

        $this->_htmlPurifier = new HTMLPurifier( $config );
    }

    public function filter( $value )
    {
        return $this->_htmlPurifier->purify( $value );
    }

}